﻿using Furion;
using Mapster.Utils;
using Microsoft.OpenApi.Extensions;
using Npoi.Mapper.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TulingMember.Application.Helper;
using TulingMember.Core;


namespace TulingMember.Application
{
    public class CustomerDto : BaseEntityDto
    {
        /// <summary>
        /// 姓名
        /// </summary>
        public string Name { get; set; }

        public string DisplayName => DisPlayNameHelper.GetDisplayName(this.Name);

        /// <summary>
        /// 电话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        public string Address { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 账户余额
        /// </summary>
        public decimal Balance { get; set; }
        /// <summary>
        /// 医保号
        /// </summary>
        public string MedicalCardNo { get; set; }
        ///// <summary>
        ///// 生日
        ///// </summary>
        //public DateTime Birthday { get; set; }
        /// <summary>
        /// 性别
        /// </summary>
        public int Sex { get; set; }
        public string SexText => Sex == 1 ? "男" : "女";

        public long DepartmentId { get; set; }
        public string DepartmentName { get; set; }

        /// <summary>
        /// 消费金额
        /// </summary>
        public decimal ConsumptionAmount { get; set; }

        /// <summary>
        /// 就诊次数
        /// </summary>
        public decimal visits { get; set; }

        ///// <summary>
        ///// 年龄
        ///// </summary>
        //public int Age => GetAge();

        //public int GetAge()
        //{
        //    DateTime now = DateTime.Today;

        //    int age = now.Year - Birthday.Year;

        //    if (Birthday.Date > now.AddYears(-age)) age--;

        //    return age;
        //}

    }

    public class CustomerExport
    {
        /// <summary>
        /// 姓名
        /// </summary>
        [Column("姓名")]
        public string Name { get; set; }
        ///// <summary>
        ///// 电话
        ///// </summary>
        //[Column("用户电话")]
        //public string Phone { get; set; }
        ///// <summary>
        ///// 地址
        ///// </summary>
        //[Column("用户地址")]
        //public string Address { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        [Column("备注")]
        public string Remark { get; set; }
        /// <summary>
        /// 账户余额
        /// </summary>
        [Column("账户余额")]
        public decimal Balance { get; set; }
        /// <summary>
        /// 医保号
        /// </summary>
        [Column("医保号")]
        public string MedicalCardNo { get; set; }
        ///// <summary>
        ///// 生日
        ///// </summary>
        //[Column("生日")]
        //public DateTime Birthday { get; set; }

        [Column("性别")]
        public string SexText { get; set; }

        [Column("部门")]
        public string DepartmentName { get; set; }

        /// <summary>
        /// 消费金额
        /// </summary>
        [Column("消费金额")]
        public decimal ConsumptionAmount { get; set; }

        /// <summary>
        /// 就诊次数
        /// </summary>
        [Column("就诊次数")]
        public int visits { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        //[Column("年龄")]
        //public int Age => GetAge();

        //public int GetAge()
        //{
        //    DateTime now = DateTime.Today;

        //    int age = now.Year - Birthday.Year;

        //    if (Birthday.Date > now.AddYears(-age)) age--;

        //    return age;
        //}
    }

}
